package android.slc.appbase.ui.vd;

import android.slc.adapter.SelectBox;

import com.blankj.utilcode.util.CollectionUtils;

import java.io.Serializable;

public abstract class BaseListMultipleSelectVmBox<T extends Serializable> extends BaseListVmBox<SelectBox<T>> {
    public boolean selectChange = false;

    public void select(int position, SelectBox<T> selectBox) {
        selectBox.setChecked(!selectBox.isChecked());
        selectChange = true;
    }

    public void selectAll(boolean selectAll) {
        CollectionUtils.forAllDo(getDataList(), (index, item) -> item.setChecked(selectAll));
        dataListOf.notifyChange();
        selectChange = true;
    }
}
